import request from '@/utils/request_zc'

export function getSaleContractList ({
  contractNo,
  orderId,
  customerId,
  salesmanId,
  deliveryStartDate,
  deliveryEndDate,
  deliveryMethod,
  signStartDate,
  signEndDate,
  applyUser,
  applyStartTime,
  applyEndTime,
  applyStatus,
  approveUser,
  approveStartTime,
  approveEndTime,
  approveStatus,
  page,
  limit, }) {
  return request({
    url: '/sales/contract/list',
    method: 'get',
    params: {
      contractNo,
      orderId,
      customerId,
      salesmanId,
      deliveryStartDate,
      deliveryEndDate,
      deliveryMethod,
      signStartDate,
      signEndDate,
      applyUser,
      applyStartTime,
      applyEndTime,
      applyStatus,
      approveUser,
      approveStartTime,
      approveEndTime,
      approveStatus,
      page,
      limit
    }
  })
}

export function EditSaleContract ({ orderId, detailList, ...Form }) {
  return request({
    url: '/sales/contract/edit',
    method: 'post',
    data: {
      orderId,
      detailList,
      ...Form
    }
  })
}

export function AddSaleContract ({ orderId, detailList, ...Form }) {
  return request({
    url: '/sales/contract/add',
    method: 'post',
    data: {
      orderId,
      detailList,
      ...Form
    }
  })
}

export function DelSaleContract ({ ids }) {
  return request({
    url: '/sales/contract/del',
    method: 'post',
    data: {
      ids
    }
  })
}

export function getSalesManList () {
  return request({
    url: '/salesman/list',
    method: 'get',
  })
}

export function SaleContractApprove ({ approveStatus, id, approveAdvice }) {
  return request({
    url: '/sales/contract/approve',
    method: 'post',
    data: {
      approveStatus,
      id,
      approveAdvice
    }
  })
}
